package com.xq.service.impl;

import com.xq.dao.UserDao;
import com.xq.dao.impl.UserDaoImpl;
import com.xq.factory.BeanFactory;
import com.xq.pojo.User;
import com.xq.service.UserService;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/5 15:13
 * @description 用户业务接口实现层
 */
public class UserServiceImpl implements UserService {

    private UserDao userDao = new UserDaoImpl();

    /**
     * 使用工厂模式创建对象
     */
    private UserDao userDao2 = BeanFactory.getUserDao();

    /**
     * 通过类全名反射创建对象
     */
    private UserDao userDao3 = BeanFactory.getBean("com.xq.dao.impl.UserDaoImpl");

    /**
     * 通过类名反射创建对象
     */
    private UserDao userDao4 = BeanFactory.getBeanProp("userDao");

    @Override
    public User getUserById(Integer id) {
        return userDao4.getUserById(id);
    }


}


